﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Lucene.Net.Analysis;
using Lucene.Net.Analysis.Standard;
using Lucene.Net.Index;

namespace Vit.PlugIn.Lucene
{
    public class IndexInfo
    {
        public IndexInfo(SegmentInfo segment)
        {
            this.Segment = segment;
            string path = segment.Lucene.DirectoryPath;
            path = Path.Combine(path, segment.ObjectType.Namespace);
            if (!System.IO.Directory.Exists(path))
                System.IO.Directory.CreateDirectory(path);
            this.File = Path.Combine(path, segment.ObjectType.Name + ".idx");

            Analyzer = new StandardAnalyzer();
            MaxBufferedDocs = IndexWriter.DEFAULT_MAX_BUFFERED_DOCS;
            MaxMergeDocs = IndexWriter.DEFAULT_MAX_MERGE_DOCS;
        }

        public string File { get; set; }
        public Analyzer Analyzer { get; set; }
        public int MaxMergeDocs { get; set; }
        public int MaxBufferedDocs { get; set; }

        public SegmentInfo Segment { get; private set; }
    }
}
